<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<body>
<script>
function chk(){
	var flag = confirm("이벤트를 해제합니다. 진행하시겠습니까?");
	if(flag){
		return true;
	}else{
		return false;		
	}
}
</script>
<h2 align="center">이벤트상품목록</h2>
<table>
	<tr align="center" bgcolor="#BDBDBD">
		<td></td>
		<td width="90">컴퓨터ID</td>
		<td width="90">이름</td>
		<td width="90">가격</td>
		<td width="50">수량</td>
		<td width="635">상세설명</td>
		<td width="100">해제</td>
	</tr>
<c:forEach items="${requestScope.event_list}" var="event">
	<tr align="center">
		<td width="90" height="90">
		<c:choose>
			<c:when test="${event.fileName!=null }">
				<img src="/droowa/product-img/${event.fileName}" style="width:90px; height=90px;">
			</c:when>
			<c:when test="${event.fileName==null}">
				<img src="/droowa/product-img/No_image.jpg" style="width:90px; height=90px;">
			</c:when>	
		</c:choose>
		</td>
		<td width="90">${event.completeId}</td>
		<td width="90">${event.completeName}</td>
		<td width="90">${event.completePrice}</td>
		<td width="50">${event.completeQuantity}</td>
		<td width="635">
		${event.mainboardName} / ${event.cpuName} / ${event.coolerName} / ${event.memoryName} / ${event.graphicName} /
		${event.hddName} / ${event.ssdName} / ${event.dvdName} / ${event.soundName} / ${event.powerName} /
		${event.caseName} / ${event.osName}
		</td>
		<td>
			<a href="/droowa/product/releaseEvent.do?completeId=${event.completeId}">
				<input type="button" onclick="return chk()" value="이벤트해제" style="width:100px;	">
			</a>
		</td>
	</tr>
</c:forEach>
</table>
<c:if test="${fn:length(requestScope.event_list) != 0 }">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/registerEvent.do?page=${requestScope.paging.startPageOfPageGroup-1}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/registerEvent.do?page=${page}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/registerEvent.do?page=${requestScope.paging.endPageOfPageGroup+1}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>
</body>